<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
use Laravel\Passport\Passport;
use Laravel\Passport\RouteRegistrar;

Route::get('/', function () {
    return redirect()->away('http://www.hzwhc.com/');;
});

Route::get('template', 'Admin\UserController@configUser');

/**
 * passport包设置中间件针对后台登录用户，不对外
 */
Passport::routes(function(RouteRegistrar $router) {
    $router->forAccessTokens();
}, ['prefix' => 'admin/oauth', 'middleware' => 'passport_custom']);

/**
 * 针对前台登录用户
 */
Passport::routes(function(RouteRegistrar $router) {
    $router->forAccessTokens();
}, ['prefix' => 'api/oauth', 'middleware' => 'passport_custom']);

/**
 * 盒子管理系统盒子用户登录
 */
Passport::routes(function(RouteRegistrar $router) {
    $router->forAccessTokens();
}, ['prefix' => 'box_owner/oauth', 'middleware' => 'passport_custom']);

/**
 * 盒子管理系统管理用户登录
 */
Passport::routes(function(RouteRegistrar $router) {
    $router->forAccessTokens();
}, ['prefix' => 'box_system/oauth', 'middleware' => 'passport_custom']);


/**
 * 登录模块
 */
Route::group(['prefix' => 'admin', 'namespace' => 'Auth'],  function () {       //, 'middleware' => ['passport_custom']
    Route::post('login', 'LoginController@login');                  //后台登录
    Route::post('logout', 'LoginController@logout');                //后台登录
    Route::post('register', 'RegisterController@register');         //后台注册
});

/**
 * 盒子管理系统
 */
Route::group(['prefix' => 'system', 'namespace' => 'Admin'],  function () {
    Route::post('login', 'SystemController@loginSystem');             //盒子用户登录
});

Route::group(['prefix' => 'system', 'namespace' => 'Admin', 'middleware' => ['system_check']], function () {       //

    /**
     * 盒子模块
     */
    Route::group(['prefix' => 'box'], function () {
        Route::post('list', 'BoxController@listBox');           //盒子列表
        Route::post('add', 'BoxController@addBox');             //盒子添加
        Route::post('edit', 'BoxController@editBox');           //盒子编辑
        Route::post('delete', 'BoxController@deleteBox');       //盒子删除
        Route::post('info', 'BoxController@infoBox');          //盒子信息
    });

    /**
     * 盒子用户模块
     */
    Route::group(['prefix' => 'owner'], function () {
        Route::post('list', 'OwnerController@listOwner');           //盒子用户列表
        Route::post('add', 'OwnerController@addOwner');             //盒子用户添加
        Route::post('edit', 'OwnerController@editOwner');           //盒子用户编辑
        Route::post('delete', 'OwnerController@deleteOwner');       //盒子用户删除
        Route::post('info', 'OwnerController@infoOwner');          //盒子用户信息
    });

    /**
     * 系统用户模块
     */
    Route::group(['prefix' => 'manager'], function () {
        Route::post('list', 'ManagerController@listManager');           //系统用户列表
        Route::post('add', 'ManagerController@addManager');             //系统用户添加
        Route::post('password', 'ManagerController@passwordManager');   //系统用户修改密码
        Route::post('delete', 'ManagerController@deleteManager');       //系统用户删除
    });

    /**
     * 盒子地区模块
     */
    Route::group(['prefix' => 'area'], function () {
        Route::post('list', 'AreaController@listArea');           //盒子地区列表
        Route::post('shop', 'AreaController@shopArea');           //盒子店铺列表
        Route::post('connect', 'AreaController@connectArea');     //关联店铺用户列表
        Route::post('bind', 'AreaController@bindArea');           //绑定店铺用户
        Route::post('add', 'AreaController@addArea');             //添加盒子地域
        Route::post('delete', 'AreaController@deleteArea');       //删除盒子地域
        Route::post('edit', 'AreaController@editArea');           //编辑盒子地域
    });
});

Route::group(['prefix' => 'admin', 'namespace' => 'Admin', 'middleware' => ['admin_check']], function () {
    /**
     * 装修内容基础设置
     */
    Route::group(['prefix' => 'basic'], function () {
        Route::post('setting', 'BasicController@settingBasic');     //基础设置
        Route::post('getting', 'BasicController@gettingBasic');     //获取基础设置
    });

    /**
     * 装修内容模块
     */
    Route::group(['prefix' => 'decoration'], function () {
        Route::post('basic', 'DecorationController@basicTemplate');     //基础页面装修
        Route::post('special', 'DecorationController@specialTemplate'); //专题页面装修
        Route::post('title', 'DecorationController@titleTemplate');     //页面标题修改
        Route::post('info', 'DecorationController@infoTemplate');       //页面内容详情
        Route::post('upload', 'DecorationController@uploadTemplate');   //上传图片
        Route::post('video', 'DecorationController@videoTemplate');     //上传视频
        Route::post('preview', 'DecorationController@previewTemplate'); //装修预览保存
        Route::post('release', 'DecorationController@releaseTemplate'); //装修模板发布
        Route::post('code', 'DecorationController@codeTemplate');       //装修模板上传
    });

    /**
     * 后台用户模块
     */
    Route::group(['prefix' => 'user'], function () {
        Route::post('info', 'UserController@infoUser');         //用户信息
        Route::post('config', 'UserController@configUser');     //用户配置
    });

    /**
     * 后台订单模块
     */
    Route::group(['prefix' => 'order'], function () {
        Route::post('list', 'OrderController@listOrder');       //订单列表
        Route::post('detail', 'OrderController@detailOrder');   //订单详情
        Route::post('remark', 'OrderController@remarkOrder');   //订单修改商家备注
    });

    /**
     * 短视频模块
     */
    Route::group(['prefix' => 'video'], function () {
        Route::post('list', 'VideoController@listVideo');           //短视频列表
        Route::post('add', 'VideoController@addVideo');             //短视频添加
        Route::post('edit', 'VideoController@editVideo');           //短视频编辑
        Route::post('delete', 'VideoController@deleteVideo');       //短视频删除
        Route::post('upload', 'VideoController@uploadVideo');       //短视频上传
    });

    /**
     * 直播间模块
     */
    Route::group(['prefix' => 'room'], function () {
        Route::post('list', 'RoomController@listRoom');           //直播间列表
        Route::post('code', 'RoomController@codeRoom');           //直播间二维码
        Route::post('detail', 'RoomController@detailRoom');       //直播间详情
        Route::post('offline', 'RoomController@offlineRoom');     //直播间下架操作
        Route::post('edit', 'RoomController@offlineRoom');        //直播间编辑
        Route::post('create', 'RoomController@createRoom');       //新建直播间
        Route::post('update', 'RoomController@updateRoom');       //编辑直播间
        Route::post('share', 'RoomController@shareRoom');         //分享直播间
        Route::post('start', 'RoomController@startRoom');         //开启/关闭直播间
    });

    /**
     * 订单模块
     */
    Route::group(['prefix' => 'order'], function () {
        Route::post('list', 'OrderController@listOrder');           //订单列表
        Route::post('detail', 'OrderController@detailOrder');       //订单详情
        Route::post('refund', 'OrderController@refundOrder');       //订单退款
        Route::post('cancel', 'OrderController@cancelOrder');       //订单取消
        Route::post('remark', 'OrderController@remarkOrder');       //订单修改备注
        Route::post('confirm', 'OrderController@confirmOrder');     //订单发货
    });

    /**
     * 商品模块
     */
    Route::group(['prefix' => 'product'], function () {
        Route::post('list', 'ProductController@listProduct');      //商品列表
        Route::post('edit', 'ProductController@editProduct');      //商品编辑
        Route::post('delete', 'ProductController@deleteProduct');  //商品删除
        Route::post('off', 'ProductController@offProduct');        //商品上下架
        Route::post('add', 'ProductController@addProduct');        //商品添加
        Route::post('info', 'ProductController@detailProduct');    //商品详情
        Route::post('code', 'ProductController@codePRoduct');      //商品二维码
    });

    /**
     * 供应商模块
     */
    Route::group(['prefix' => 'supply'], function () {
        Route::post('list', 'SupplyController@listSupply');       //供应商列表
        Route::post('total', 'SupplyController@totalSupply');     //供应商总数量
        Route::post('delete', 'SupplyController@deleteSupply');   //供应商删除
        Route::post('add', 'SupplyController@addSupply');         //供应商添加
        Route::post('edit', 'SupplyController@editSupply');       //供应商编辑
    });

    /**
     * 主播模块
     */
    Route::group(['prefix' => 'anchor'], function () {
        Route::post('list', 'AnchorController@listAnchor');       //主播列表
        Route::post('delete', 'AnchorController@deleteAnchor');   //主播删除
        Route::post('add', 'AnchorController@addAnchor');         //主播添加
        Route::post('edit', 'AnchorController@editAnchor');       //主播编辑
    });

    /**
     * 属性模块
     */
    Route::group(['prefix' => 'attribute'], function () {
        Route::post('list', 'AttributeController@listAttr');    //属性列表
        Route::post('delete', 'AttributeController@deleteAttr');//属性删除
        Route::post('add', 'AttributeController@addAttr');      //属性添加
    });

    /**
     * 分类模块
     */
    Route::group(['prefix' => 'category'], function () {
        Route::post('list', 'CategoryController@listCat');      //分类列表
        Route::post('delete', 'CategoryController@deleteCat');  //分类删除
        Route::post('add', 'CategoryController@addCat');        //分类添加
        Route::post('off', 'CategoryController@offCat');        //分类下架
    });

    /**
     * 品牌模块
     */
    Route::group(['prefix' => 'brand'], function () {
        Route::post('list', 'BrandController@listBrand');      //品牌列表
        Route::post('total', 'BrandController@totalBrand');    //品牌总数
        Route::post('info', 'BrandController@infoBrand');      //品牌详情
        Route::post('edit', 'BrandController@editBrand');      //品牌编辑
        Route::post('delete', 'BrandController@deleteBrand');  //品牌删除
        Route::post('add', 'BrandController@addBrand');        //品牌添加
    });

    /**
     * 店铺模块
     */
    Route::group(['prefix' => 'shop'], function () {
        Route::post('add', 'ShopController@addShop');           //店铺添加
        Route::post('list', 'ShopController@listShop');         //店铺列表
        Route::post('info', 'ShopController@infoShop');         //店铺详情
        Route::post('edit', 'ShopController@editShop');         //店铺编辑
        Route::post('delete', 'ShopController@deleteShop');     //店铺删除
        Route::post('lock', 'ShopController@lockShop');         //店铺锁定
        Route::post('verify', 'ShopController@verifyShop');     //店铺审核
    });

    /**
     * 标签模块
     */
    Route::group(['prefix' => 'tag'], function () {
        Route::post('list', 'TagController@listTag');          //标签列表
        Route::post('delete', 'TagController@deleteTag');      //标签删除
        Route::post('add', 'TagController@addTag');            //标签添加
    });

    /**
     * 快递模块
     */
    Route::group(['prefix' => 'express'], function () {
        Route::post('list', 'ExpressController@listExpress');          //快递列表
        Route::post('delete', 'ExpressController@deleteExpress');      //快递删除
        Route::post('add', 'ExpressController@addExpress');            //快递添加
        Route::post('edit', 'ExpressController@editExpress');          //快递添加
    });

    /**
     * 用户模块
     */
    Route::group(['prefix' => 'member'], function () {
        Route::post('list', 'MemberController@listMember');          //用户列表
        Route::post('retail', 'MemberController@retailMember');      //用户删除
        Route::post('update', 'MemberController@updateMember');      //用户更新
    });

    /**
     * 直播间模块
     */
    Route::group(['prefix' => 'cloud'], function () {
        Route::post('notify', 'CloudController@cloudNotify');          //直播间添加
        Route::post('create', 'CloudController@cloudCreate');          //直播间添加
    });

    /**
     * 售后订单模块
     */
    Route::group(['prefix' => 'refund'], function () {
        Route::post('list', 'RefundController@listRefund');          //退款订单列表
        Route::post('detail', 'RefundController@detailRefund');      //退款订单详情
    });
});

